package com.briup.ch03;

/**
 * 1-7 周几
 */
public class Test06 {
    public static void weekif(int num){
        if(num<1 || num>7){
            System.out.println("非法数字");
            return;
        }

        if(num==1){
            System.out.println("周一");
        }else if(num==2){
            System.out.println("周二");
        }else if(num==3){
            System.out.println("周三");
        }else if(num==4){
            System.out.println("周四");
        }else if(num==5){
            System.out.println("周五");
        }else if(num==6){
            System.out.println("周六");
        }else if(num==7){
            System.out.println("周日");
        }
    }
    public static void weekif2(int num){
        if(num<1 || num>7){
            System.out.println("非法数字");
            return;
        }
        if(num>=1 &&  num<=5){
            System.out.println("工作日");
        }else{
            System.out.println("周末");
        }
    }
    public static void weekswitch(int num){
        switch (num){
            case 1:
                System.out.println("周一");
                break;
            case 2:
                System.out.println("周二");
                break;
            case 3:
                System.out.println("周三");
                break;
            case 4:
                System.out.println("周四");
                break;
            case 5:
                System.out.println("周五");
                break;
            case 6:
                System.out.println("周六");
                break;
            case 7:
                System.out.println("周日");
                break;
            default:
                System.out.println("非法数字");
        }
    }

    public static void weekswitch2(int num){
        switch (num){
            case 1:
                System.out.println("周一");
            case 2:
                System.out.println("周二");
            case 3:
                System.out.println("周三");
            case 4:
                System.out.println("周四");
            case 5:
                System.out.println("周五");
                break;
            case 6:
                System.out.println("周六");
            case 7:
                System.out.println("周日");
                break;
            default:
                System.out.println("非法数字");
        }
    }

    public static void weekswitch3(int num){
        switch (num){
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                System.out.println("工作日");
                break;
            case 6:
            case 7:
                System.out.println("周末");
                break;
            default:
                System.out.println("非法数字");
        }
    }
}
